import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

Item {
    id: topAreaBack

    width: 150
    height: 1080

    property real button_Width: 140
    property real button_Height: 140
    property real buttonFontSize : Cpp_Language.CurrentLanguage === 1 ? 30 : Cpp_Language.CurrentLanguage === 2 ? 15 : Cpp_Language.CurrentLanguage === 3 ? 15 : 30
    property int currentPage: 1


    Component.onCompleted: {
        currentPage = 1
    }

    Rectangle{
        anchors.fill: parent
        color: "gray"
    }
    Rectangle{
        anchors.right: topAreaBack.right
        height: topAreaBack.height
        width: 2
        color: "black"
    }

    Column{
        anchors.top: topAreaBack.top
        anchors.topMargin: 5
        anchors.horizontalCenter: topAreaBack.horizontalCenter
        spacing: 5

        A_ImageButton{
            buttonWidth: button_Width
            buttonHeight: button_Height
            imageWidth : 90
            imageHeight: 90
            contentText_Fontsize: buttonFontSize
            imageSource: "qrc:/ButtonImageSource/Images/ManualProcess.png"
            contentText_Data : qsTr("手动加工")
            isSelected :  currentPage === 1

            onButtonClicked: {
                currentPage = 1
                rootLoader.source = "Manual_Process_Window.qml"
            }

        }
        A_ImageButton{
            buttonWidth: button_Width
            buttonHeight: button_Height
            imageWidth : 90
            imageHeight: 90
            contentText_Fontsize: buttonFontSize
            imageSource: "qrc:/ButtonImageSource/Images/Edit.png"
            contentText_Data : qsTr("料单界面")
            isSelected :  currentPage === 2

            onButtonClicked: {
                currentPage = 2
                rootLoader.source = "Material_List_Window.qml"
            }
        }
        A_ImageButton{
            buttonWidth: button_Width
            buttonHeight: button_Height
            imageWidth : 90
            imageHeight: 90
            contentText_Fontsize: buttonFontSize
            imageSource: "qrc:/ButtonImageSource/Images/IO_Monitor.png"
            contentText_Data : qsTr("调试界面")
            isSelected :  currentPage === 3

            onButtonClicked: {
                currentPage = 3
                rootLoader.source = "Manual_Deubg_Window.qml"
            }
        }
        A_ImageButton{
            buttonWidth: button_Width
            buttonHeight: button_Height
            imageWidth : 90
            imageHeight: 90
            contentText_Fontsize: buttonFontSize
            imageSource: "qrc:/ButtonImageSource/Images/Parameter.png"
            contentText_Data : qsTr("参数设置")
            isSelected :  currentPage === 4

            onButtonClicked: {
                currentPage = 4
                rootLoader.source = "Parameter_Setting_Window.qml"
            }
        }
        A_ImageButton{
            buttonWidth: button_Width
            buttonHeight: button_Height
            imageWidth : 90
            imageHeight: 90
            contentText_Fontsize: buttonFontSize
            imageSource: "qrc:/ButtonImageSource/Images/SystemDIY.png"
            contentText_Data : qsTr("设备配置")
            isSelected :  currentPage === 5

            onButtonClicked: {
                if(Cpp_PLC.Log_Flag)
                {
                    currentPage = 5
                    rootLoader.source = "ConfigSystemWindow.qml"
                }
                else
                {
                    passwdManager.visible = true
                }

            }
        }

        Rectangle{
            width: 90
            height: 200
            color: "transparent"
        }

        A_ImageButton{
            buttonWidth: button_Width
            buttonHeight: button_Height
            imageWidth : 90
            imageHeight: 90
            contentText_Fontsize: buttonFontSize
            imageSource: "qrc:/ButtonImageSource/Images/Power.png"
            contentText_Data : qsTr("退出程序")

            onButtonClicked: {
                Qt.quit()
            }

        }



    }

}
